import java.util.Iterator;
import java.util.LinkedList;

public class Example15_3 {
    public static void main(String[] args) {
        LinkedList mylist=new LinkedList();
        mylist.add("Yan");
        mylist.add("Han");
        int number=mylist.size();
        for (int i=0;i<number;i++) {
            String temp=(String)mylist.get(i);
            System.out.println("第"+i+"结点中的数据为："+temp);
        }
        Iterator iter=mylist.iterator();
        while(iter.hasNext())  {
            String te=(String)iter.next();
            System.out.println(te);
        }
    }
}